/**
 * Demonstrates a range of Button options the framework offers out of the box
 */
Ext.define('cloud.view.push.Push', {
    extend: 'Ext.navigation.View',
    xtype: 'push',
    requires: ['Ext.List', 'Ext.TitleBar', 'Ext.field.Select', 'Ext.field.Search'],
    config: {
        defaultBackButtonText:'返回',
        items: [
            {
                xtype: 'container',
                layout: 'vbox',
                title: '推送列表',
                items: [
                    {
                        html:
                            '<table class="tabclass tabclassHtml">' +
                                '<tr>' +
                                '<td>用户</td>' +
                                '<td style="width: 22%;min-width: 300px;">设备的uid</td>' +
                                //'<td>推送token</td>' +
                                '<td>推送版本信息</td>' +
                                '<td>时间</td>' +
                                '<td>操作</td>' +
                                '</tr>' +
                                '</table>'
                    },
                    {
                        xtype: 'list',
                        store: 'Push',
                        emptyText: '木有数据',
                        pressedCls: false,
                        selectedCls: false,
                        cls: 'x-list3',
                        flex: 1,
                        itemTpl:
                            '<table class="tabclass">' +
                                '<tr>' +
                                '<td>{name}</td>' +
                                '<td style="width: 22%; min-width: 300px;">{udid}</td>' +
                                //'<td>{token}</td>' +
                                '<td>{versions}     {operator}   {brand}</td>' +
                                '<td>{[Ext.Date.format(new Date(parseInt(values.lasttime) * 1000), "Y-m-d H:i")]}</td>' +
                                '<td><input type="button" value="推送消息" name="click_push" /></td>' +
                                '</tr>' +
                                '</table>',
                        plugins: [
                            {
                                xclass: 'Ext.plugin.PullRefresh',
                                pullRefreshText: '下拉可以更新',
                                releaseRefreshText: '松开开始更新',
                                style:'top:12px',
                                loadingText: '正在刷新……',
                                refreshFn: function (loaded, arguments) {
                                    loaded.getList().getStore().loadPage(1, {
                                        callback: function (record, operation, success) {
                                            Ext.Viewport.unmask();
                                        }, scope: this });
                                }
                            },
                            {
                                xclass: 'Ext.plugin.ListPaging',
                                loadMoreText: '<h2 style="text-align: center; padding-top: 20px; padding-bottom: 20px;">点击加载更多。。。。</h2>',
                                noMoreRecordsText: '<h2 style="text-align: center; padding-top: 20px; padding-bottom: 20px;">没有更多条记录了</h2>',
                                autoPaging: false //设置为TRUE将自动触发
                            }
                        ]
                        ,
                        listeners:{
                            initialize: function(){
                                Ext.getStore('Push').getProxy().setExtraParam('caid',localStorage.getItem('caid'));
                                Ext.getStore('Push').loadPage(1);
                            }
                        }
                    },
                    {
                        xtype: 'toolbar',
                        id: 'toolbar_bottom',
                        docked: 'bottom',
                        layout: {
                            type: 'hbox',
                            pack: 'center'
                        },
                        items: [
                            {
                                xtype: 'button',
                                id: 'btn_push',
                                cls:'x-button2',
                                iconMask: true,
                                text:'按条件推送消息'
                            }
                        ]
                    }
                ]
            }

        ]
    }
});